package com.example.smartcity.ui.Adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.example.smartcity.R;
import com.google.android.material.textfield.TextInputEditText;

import java.util.ArrayList;
import java.util.List;

public class groupListViewAdapter extends ArrayAdapter {
    private int resource;
    private ArrayList<ArrayList<String>> list;
    public groupListViewAdapter(@NonNull Context context, int resource, @NonNull ArrayList<ArrayList<String>> objects) {
        super(context, resource, objects);
        this.resource = resource;
        this.list = objects;
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
        @SuppressLint("ViewHolder") View view = LayoutInflater.from(parent.getContext()).inflate(resource,parent,false);
        TextInputEditText type = view.findViewById(R.id.type);
        TextInputEditText  kind = view.findViewById(R.id.kind);
        TextInputEditText number = view.findViewById(R.id.number);
        type.setText(list.get(position).get(0));
        kind.setText(list.get(position).get(1));
        number.setText(list.get(position).get(2));
        return view;
    }
}
